<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\admin\model;

use think\Db;
use think\Model;

class UserModel extends Model
{

    protected $type = [
        'more' => 'array',
    ];

    //查询出所有的用户
    public function userList()
    {
     return    Db::table('qy_user')
            ->select();
    }

    //admin 名称
    public function adminName()
    {
        return Db::table('qy_user')
            ->where('id',1)
            ->value('user_nickname');
    }

    //查询 通过szxinxiang id  查询用户名称
    public function selectName($id)
    {
        return Db::table('qy_user')
            ->alias('u')
            ->join('szxinxiang s','u.id = s.dealunit')
            ->where('s.id',$id)
            ->value('u.user_nickname');
    }
}